<?php
if($_POST['edit']!=true) echo '';
else{
$article_name=trim(addslashes($_POST['article']));
$article_descr=trim(addslashes($_POST['descr_article']));
$article_content=trim(addslashes($_POST['content']));
$to=$_POST['where'];

$select_article_name='SELECT article_name FROM articles WHERE article_name="'.$article_name.'" AND article_id!="'.$_GET['id'].'"';
$r=mysql_query($select_article_name);

if(mysql_num_rows($r)!=0){
echo "<p class='error'>Името съществува!</p>";
}
else{
if(empty($article_name)||empty($article_content)||empty($article_descr)){
echo "<p class='error'>Моля Попълнете Всички полета!</p>";
}
else{
$sql='UPDATE articles SET place="'.$to.'", article_name="' . $article_name . '", content="' . $article_content . '", article_descr="'.$article_descr.'" WHERE article_id="' . $_GET['id'] . '"';
$re=mysql_query($sql);
echo "<p class='success'>Успешно обновяване!</p>";
echo '<meta http-equiv="refresh" content="0;url=see_articles.php?name='.$_GET['name'].'&amp;module='.$to.'&amp;id=' .$_GET['id']. '">';
}
}
}
?>